import request from '@/utils/request'

// 查询小程序商户列表
export function listApplet(query) {
  return request({
    url: '/wechat/applet/list',
    method: 'get',
    params: query
  })
}

// 查询小程序商户列表
export function appletList(query) {
  return request({
    url: '/wechat/applet/appletList',
    method: 'get',
    params: query
  })
}

// 查询小程序商户列表
export function listAuthorityApplet() {
  return request({
    url: '/wechat/applet/getAuthorityAppList',
    method: 'get'
  })
}

// 查询小程序商户列表
export function getExtAppid() {
  return request({
    url: '/wechat/applet/getExtAppid',
    method: 'get'
  })
}

// 查询小程序商户列表
export function setExtAppid(extAppid) {
  return request({
    url: '/wechat/applet/setExtAppid/'+extAppid,
    method: 'get'
  })
}

// 查询小程序商户详细
export function getApplet(id) {
  return request({
    url: '/wechat/applet/' + id,
    method: 'get'
  })
}

// 查询小程序商户详细
export function refreshApplet(appid) {
  return request({
    url: '/wechat/applet/refreshApplet/' + appid,
    method: 'get'
  })
}


// 新增小程序商户
export function addApplet(data) {
  return request({
    url: '/wechat/applet',
    method: 'post',
    data: data
  })
}


// 修改小程序商户
export function updateApplet(data) {
  return request({
    url: '/wechat/applet',
    method: 'put',
    data: data
  })
}

// 删除小程序商户
export function delApplet(id) {
  return request({
    url: '/wechat/applet/' + id,
    method: 'delete'
  })
}


export function changeAppletStatus(id, openStatus) {
  const data = {
    id,
    openStatus
  }
  return request({
    url: '/wechat/applet',
    method: 'put',
    data: data
  })
}

